﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:Sautom.Modules.Proposal.Controls" xmlns:l="clr-namespace:Sautom.ClientComunication.Converters;assembly=Sautom.ClientComunication">
    <l:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
    <l:InverseBooleanConverter x:Key="InverseBooleanConverter" />

    <DataTemplate x:Key="ListBoxTemplateWithCheckBoxes">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="30" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <CheckBox IsChecked="{Binding IsSelected}" />
            <TextBlock Grid.Column="1" Text="{Binding Value}" />
        </Grid>
    </DataTemplate>
    <DataTemplate x:Key="ListBoxTemplateWithRadioButtons">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="30" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Controls:CustomRadioButton GroupName="{Binding SelectionGroup}" 
                             IsChecked="{Binding IsSelected, Mode=TwoWay}" />
            <TextBlock Grid.Column="1" Text="{Binding Value}" />
        </Grid>
    </DataTemplate>
    <Style TargetType="{x:Type ListBox}">
        <Setter Property="ItemTemplate" Value="{StaticResource ListBoxTemplateWithCheckBoxes}" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsGroupType}" Value="true">
                <Setter Property="ItemTemplate" Value="{StaticResource ListBoxTemplateWithRadioButtons}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>